import { View } from "@tarojs/components";
import SearchBar from "@/components/common/SearchBar";
import NavBar from "@/components/menus/NavBar";
import { Empty } from "@taroify/core";
import { useState } from "react";
import ScrollMenu from "@/components/menus/ScrollMenu";
import ArticleCard from "@/components/article/ArticleCard";
import { ArticleCardType } from "@/types";
import BarList from "@/components/bar/BarList";

export default () => {
  const [key, setKey] = useState("");

  const testData: ArticleCardType = {
    user: {
      avatar: "http://127.0.0.1:9999/statics/admin.jpg",
      username: "瑶瑶混日子",
      kid: "1864273892504383489",
      email: "3034221968@qq.com",
      phone: "17508561337",
      address: "局域网",
      sex: "2",
      ipAddr: "192.168.1.11",
      blackGround: "http://localhost:9999/statics/background/back.jpg",
      password: "1d9751757881f4c3fd1f840eccc532d4",
    },
    article: {
      kid: "1",
      context: "笑死我了。\n不是，这是什么鬼",
      title: "文章示例",
      createTime: "2024-10-10",
      contextUrl:
        "http://localhost:9999/statics/touste.jpg,http://localhost:9999/statics/video.jpg,http://localhost:9999/statics/video.jpg,http://localhost:9999/statics/video.jpg,http://localhost:9999/statics/video.jpg,http://localhost:9999/statics/video.jpg",
      typeFlag: "0",
      // video:
      //   "http://127.0.0.1:9999/post/display?fileName=http://192.168.1.11:9000/forum/20241217/7b0062ae-daea-4076-9d86-cd105d0a344d.mp4",
    },
  };

  return (
    <NavBar left=" " title={<SearchBar act />}>
      <ScrollMenu type="center" bar defaultIndex={1}>
        <ScrollMenu.Item title="热门">1</ScrollMenu.Item>
        <ScrollMenu.Item title="推荐" className="p-2">
          <BarList />
          <View className="grid grid-cols-1 gap-3 mt-3">
            <ArticleCard {...testData} />
          </View>
        </ScrollMenu.Item>
        <ScrollMenu.Item title="关注">
          <Empty>
            <Empty.Image src="network" />
            <Empty.Description>还没有人引起你的关注哦</Empty.Description>
          </Empty>
        </ScrollMenu.Item>
      </ScrollMenu>
    </NavBar>
  );
};
